<?php

class Contact extends BaseActiveRecord
{
    public $verifyCode;
    
    public function tableName()
    {
        return '{{contacts}}';
    }

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
    
    public function rules() 
    {
        return array
        (
            array('contact_name, contact_email, contact_text', 'required'),
            array('contact_email', 'email'),
            array('contact_phone, contact_title', 'safe'),
            array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !extension_loaded('gd'))
        );
    }
    
    public function attributeLabels()
    {
        return array
        (
            'contact_name'  => 'Имя',
            'contact_email' => 'Email',
            'contact_phone' => 'Телефон',
            'contact_title' => 'Тема',
            'contact_text'  => 'Сообщение'
        );
    }
}
